// JavaScript Document
window.onload=function(){
		setTrState();
		bindCountrySelect();
}

function bindCountrySelect()
{
	var country = document.getElementById("country");
	var country2 = document.getElementById("country2");
	country.onchange = function(){			
			
			setTrState();
	}
	country2.onchange = function(){	
	
			setTrState();
	}
}
function setTrState()
{
	var country = document.getElementById("country");
	var country2 = document.getElementById("country2");
	var trProvince = document.getElementById("trProvince");
	var trProvince2 = document.getElementById("trProvince2");
	var check1 =  document.getElementById("check1");		
	
	//选中如下三个国家的时候,province 栏目隐藏
	if(country.value == "Denmark" || country.value == "Sweden" || country.value =="Norway")
	{				
		trProvince.style.display="none";
		if(check1.checked)
		{
			country2.value = country.value;
		}
	}
	else
	{
		trProvince.style.display="";
		if(check1.checked)
		{
			country2.value = country.value;
		}			
	}	
		//选中如下三个国家的时候,province 栏目隐藏
	if(country2.value == "Denmark" || country2.value == "Sweden" || country2.value == "Norway")
	{				
		trProvince2.style.display="none";
	}
	else
	{
		trProvince2.style.display="";
	}
}
function copyAddress(form2) {
    if (document.form2.check1.checked==true) {
        form2.street2.value=form2.street.value;
        form2.city2.value=form2.city.value;
        form2.state2.value=form2.state.value;
        form2.zip2.value=form2.zip.value;
        form2.country2.value=form2.country.value;
    } else {
        form2.street2.value="";
        form2.city2.value="";
        form2.state2.value="";
        form2.zip2.value="";
        form2.country2.value="Denmark";
    }
	setTrState();
}